<template>
  <div>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="图书导入" name="bookImport">
        <ImportBook ref="bookImport"/>
      </el-tab-pane>
      <el-tab-pane label="入库术语" name="dataBase">
        <DataBaseBookTable ref="dataBase"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import DataBaseBookTable from "./DataBaseBookTable";
import ImportBook from "./ImportBook";

export default {
  name: 'Term',
  components: {
    ImportBook,
    DataBaseBookTable
  },
  data() {
    return {
      activeName: 'bookImport'
    }
  },
  methods: {
    handleClick(tab, event) {
      if (tab.name == 'bookImport') {
        this.$refs.bookImport.getTableData();
      } else {
        this.$refs.dataBase.getTableData();
      }
    },
  },
  activated() {
    if (!this.$route.meta.isUseCache) {
      this.$refs.bookImport.getTableData();
      this.$refs.dataBase.getTableData();
    }
  },
}
</script>

<style scoped>

</style>
